package pro.cherish.knowledgedemoasync.t2;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import java.util.concurrent.Future;

/**
 * @author 创建人：cherish
 * @version 版本号：V1.0
 * <p>
 * ***************************修订记录************************************
 * 2019-10-27 cherish 创建该类功能。
 * **********************************************************************
 * </p>
 * @ClassName 类名：testReturn
 * @Description 功能说明：
 * <p>
 * TODO
 * </p>
 * **********************************************************************
 * @date 创建日期： 2019-10-27 cherish
 */
@Component
@Slf4j
public class TestReturn {

    @Async
    public Future<Object> getSomething(String msg) throws InterruptedException {
        log.info("begin 异步构建消息");
        String newMsg = "【【【" + msg + "】】】";
        Thread.sleep(5000);
        log.info("end 异步构建消息");
        AsyncResult<Object> asyncResult = new AsyncResult<>(newMsg);
        return asyncResult;
    }



}
